<template>
  <div class="mui-numbox" data-numbox-min="1" style="height:30px">
    <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
    <input id="test" class="mui-input-numbox" ref="number" type="number" :value="count" @change="goodscountChange">
    <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
  </div>
</template>


<script>
import mui from '../../lib/mui/dist/js/mui.min.js'

export default {
  data() {
    return {
      numbox: { },
      goodscount: 1
    }
  },
  methods: {
    goodscountChange() {
      console.log(this.$refs.number.value)
      this.$store.commit('editShopCarGoodsCount', { id: this.id, count: this.numbox.getValue() })
    }
  },
  mounted() {
    this.numbox = mui('.mui-numbox').numbox()
  },
  props: ['count', 'id'],
  watch:{
    count: function(newv, oldv) {
      this.numbox.setValue(parseInt(newv))
    }
  }
};
</script>

<style lang="scss" scoped>
</style>
